#include<string>
#include<iostream>
using namespace std;


//日志等级
enum 
{
  NOMAL,
  DEBUG,
  WARNING,
  ERROR,
  FATAL
};

#define LOG(N) log(#N,__FILE__,__LINE__) 

ostream& log(string level,string file,int line)
{
  string str;
  str += '[';
  str += "日志等级:";
  str += level;
  str += ']';
 
  str += '[';
  str += "文件名:";
  str += file;
  str += ']';


  str += '[';
  str += "行号:";
  str += to_string(line);
  str += ']';
  
  
  str += '[';
  str += "时间戳:";
  str += to_string(time(nullptr));
  str += ']';
  
  cout <<str;//将str暂存到语言级别缓冲区
  return std::cout;
}
